import './index.scss'
import { connect } from 'react-redux'
import { FC } from 'react'
import Header from '@/components/header'
import Banner from '@/components/banner'
import Market from './components/market'
import AirDrop from './components/airdrop'
import Token from '@/components/token'
import GameFragment from "@/components/GameFragment"
import PlanHistory from "@/components/plan"
import Footer from '@/components/footer'

interface IIndex {
    changeLanguage: (intl: any, local: string) => void;
    intl: any,
    local?: string
}

const Index: FC<IIndex> = () => {


    return (
        <div className="index center">
            <Header />
            <Banner />
            <Market />
            <AirDrop />
            <GameFragment />
            <Token />
            <PlanHistory />
            <Footer />
        </div>
    )
}

const mapStoreToProps = (state: any) => {
    return {
        intl: state.intl,
        local: state.intl.local
    }
}

const mapDispatchToProps = (dispatch: any) => {
    return {
        changeLanguage(intl: any, local: string) {
            intl.loacl = intl.local = local;
            const action = {type: "intl", data: intl}
            localStorage.setItem('local', local)
            dispatch(action)
        }
    }
}

export default connect(mapStoreToProps,mapDispatchToProps)(Index);
